package com.chainyoung.component_tmtrade.ui.mvp.model;

import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmtrade.api.TradeService;
import com.chainyoung.component_tmtrade.bean.RegionList;
import com.chainyoung.component_tmtrade.ui.mvp.contract.TradeCurrencyCurrentListContract;
import com.chainyoung.component_tmtrade.ui.mvp.contract.TradeCurrencyTypeListContract;

import javax.inject.Inject;

import io.reactivex.Flowable;

@ActivityScope
public class TradeCurrencyTypeListModel extends BaseModel implements TradeCurrencyTypeListContract.Model {

    @Inject
    public TradeCurrencyTypeListModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }


    @Override
    public Flowable<RegionList> getCurrencyTypeList() {
        return mRepositoryManager.obtainRetrofitService(TradeService.class)
                .getRegionList()
                .compose(RxUtils.<RegionList>handleResult());
    }
}
